//
//  GQHEnterpriseAuthorizationInfoController.m
//  Xanthium
//
//  Created by GuanQinghao on 31/03/2018.
//  Copyright © 2018 GuanQinghao. All rights reserved.
//

#pragma mark Macro
#import "GQHHeader.h"

#pragma mark Model

#pragma mark Object

#pragma mark View
#import "GQHEnterpriseAuthorizationInfoView.h"

#pragma mark Controller
#import "GQHEnterpriseAuthorizationInfoController.h"

#pragma mark CocoaPods

#pragma mark ----------Header End----------

@interface GQHEnterpriseAuthorizationInfoController () {
    
#pragma mark Data
    NSMutableArray *contentArray;
#pragma mark View
    /// 自定义根视图
    GQHEnterpriseAuthorizationInfoView *rootView;
}

@end


@implementation GQHEnterpriseAuthorizationInfoController

#pragma mark --Lifecycle
- (void)loadView {
    DLog();
    
    rootView = [[GQHEnterpriseAuthorizationInfoView alloc] initWithFrame:[UIScreen mainScreen].bounds];
    self.view = rootView;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    DLog();
    
    [self loadLocalData];
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    DLog();
    
    self.qh_titleLabel.text = @"物流企业认证信息";
    [self.qh_rightButton setHidden:YES];
    self.automaticallyAdjustsScrollViewInsets = NO;
}

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    DLog();
    
}

#pragma mark --Delegate

#pragma mark --TargetMethod

#pragma mark --PrivateMethod
- (void)loadLocalData {
    
//    titleArray = @[@"公司名称",@"公司地址",@"联系人",@"联系人电话",@"身份证号",@"营业执照编号",@"营业执照",@"道路运输经营许可证"];
    
    /**
     "userId": "4028b881627b535d01627b64a635000e",
     "companyName": "哈哈",
     "companyAdd": "呵呵",
     "empName": "物流企业",
     "phoneNum": "18792684153",
     "busIdCard": "610221199209213621",
     "busLicNum": "21765265983169856315",
     "businessLicPhoto": "b03e3d17-af29-48e2-bf40-5437074e2308.jpg",
     "roadTraBuLic": "9a0c74cf-e6b0-4327-a951-931ebff5370f.jpg",
     "name": "物流企业",
     "phone": "18792684153",
     "applyTime": "2018-03-31 17:31:19",
     "auditTime": "2018-03-31 17:32:45",
     "auditState": "01"
     */
    
    contentArray = [NSMutableArray arrayWithCapacity:20];
    
    // 公司名称
    NSString *companyName = [_qh_authenticatedInfo objectForKey:@"companyName"];
    [contentArray qh_safetySetObject:companyName atIndex:0];
    
    // 公司地址
    NSString *companyAdd = [_qh_authenticatedInfo objectForKey:@"companyAdd"];
    [contentArray qh_safetySetObject:companyAdd atIndex:1];
    
    // 联系人
    NSString *empName = [_qh_authenticatedInfo objectForKey:@"empName"];
    [contentArray qh_safetySetObject:empName atIndex:2];
    
    // 联系人电话
    NSString *phoneNum = [_qh_authenticatedInfo objectForKey:@"phoneNum"];
    [contentArray qh_safetySetObject:phoneNum atIndex:3];
    
    // 身份证号
    NSString *busIdCard = [_qh_authenticatedInfo objectForKey:@"busIdCard"];
    [contentArray qh_safetySetObject:busIdCard atIndex:4];
    
    // 营业执照编号
    NSString *busLicNum = [_qh_authenticatedInfo objectForKey:@"busLicNum"];
    [contentArray qh_safetySetObject:busLicNum atIndex:5];
    
    // 营业执照
    NSString *businessLicPhoto = [NSString stringWithFormat:@"%@%@",[NSString qh_imageURLString],[_qh_authenticatedInfo objectForKey:@"businessLicPhoto"]];
    [contentArray qh_safetySetObject:businessLicPhoto atIndex:6];
    
    // 道路运输经营许可证
    NSString *roadTraBuLic = [NSString stringWithFormat:@"%@%@",[NSString qh_imageURLString],[_qh_authenticatedInfo objectForKey:@"roadTraBuLic"]];
    [contentArray qh_safetySetObject:roadTraBuLic atIndex:7];
    
    rootView.qh_contentArray = contentArray;
    [rootView.qh_tableView reloadData];
}

#pragma mark --Setter

#pragma mark --Getter

#pragma mark --View

@end
